Skip to content

Conversation

@renchris
Copy link
Contributor

@renchris renchris commented Dec 1, 2025

Summary

  • Remove unstable_batchedUpdates from react-dom - no longer needed with React 19's automatic batching
  • Update peer dependencies to require React 19+

Motivation

React 18+ introduced automatic batching for all state updates, making unstable_batchedUpdates unnecessary.
The React team has indicated this API will be removed in a future version. React 19 is now stable and
widely adopted, making this a good time to modernize the library.

References:

Changes

  • Remove import {unstable_batchedUpdates} from 'react-dom'
  • Remove unstable_batchedUpdates() wrapper in doCallback()
  • Update comment to explain React 19+ automatic batching
  • Update peerDependencies: react ^19.0.0
  • Update version to 6.0.0

Breaking Changes

  • Drops support for React 16, 17, and 18
  • Requires React 19.0.0 or higher

Test Plan

  • TypeScript type checking passes (npm run check-types)
  • ESLint passes (npm run lint)
  • 4/5 tests pass with current React 17 dev setup
  • "Batching of subscriptions" test fails with React 17 (expected - React 17 doesn't have automatic batching)
  • All tests will pass with React 19 (automatic batching handles the batching that unstable_batchedUpdates previously did)

Note: The dev dependencies use React 17 ESM bundles (@esm-bundle/react@^17). The batching test fails because React 17 doesn't have automatic batching. When the test infrastructure is updated to React 19, all tests will pass.

BREAKING CHANGE: Drops support for React 16, 17, and 18. Requires React 19+.

- Remove `import {unstable_batchedUpdates} from 'react-dom'`
- Remove `unstable_batchedUpdates()` wrapper in `doCallback()`
- Update comment to explain React 19+ automatic batching
- Update peerDependencies to require React 19

React 18+ introduced automatic batching for all state updates,
making `unstable_batchedUpdates` unnecessary. The React team has
indicated this API will be removed in a future version.

Closes rocicorp#56
@renchris renchris force-pushed the feat/react-19-automatic-batching branch from 2df8c35 to 91749df Compare December 1, 2025 23:32
- Updated package.json to replace web-test-runner with vitest for testing.
- Modified test scripts to use vitest commands.
- Updated devDependencies to include vitest and related packages.
- Refactored index.test.tsx to use vitest's expect and test functions.
- Added vitest configuration file for browser testing setup.
- Removed web-test-runner configuration file as it is no longer needed.
@arv arv self-requested a review December 2, 2025 09:38
arv and others added 2 commits December 2, 2025 10:39
BREAKING CHANGE: Drops support for React 16, 17, and 18. Requires React 19+.

- Remove `import {unstable_batchedUpdates} from 'react-dom'`
- Remove `unstable_batchedUpdates()` wrapper in `doCallback()`
- Update comment to explain React 19+ automatic batching
- Update peerDependencies to require React 19

React 18+ introduced automatic batching for all state updates,
making `unstable_batchedUpdates` unnecessary. The React team has
indicated this API will be removed in a future version.

Closes rocicorp#56
@arv
Copy link
Contributor

arv commented Dec 2, 2025

Closed by #67

@arv arv closed this Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants